<template>
	<view style="padding: 30px;">
		<view>异步接口</view>
		<button @click="callStorageFun(1)" >setStorage</button>
		<button @click="callStorageFun(2)" type="primary" plain="ture">getStorage</button>
		<button @click="callStorageFun(3)" type="warn">getStorageinfo</button>
		<button @click="callStorageFun(4)" type="primary" plain="ture">RemoveStorage</button>
		<button @click="callStorageFun(5)" type="warn">clearStorage</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:"zhengsan",
				timer1:null
			}
		},
		methods: {
			callStorageFun(parm){
				console.log("callStorageFun==> parm "+parm);
				switch(parm){
					case 1:
						uni.setStorage({
							key:"UserName",
							data:'kjw',
							success(){
								console.log("存储成功")
							}
						})
						break;
					case 2:
					uni.setStorage({
						key:"Accout",
						success(){
							console.log("读取Accout成功");
						},
						fail(){
							console.log("读取Accout失败");
						}
					})
				}
			}
		}
	}
</script>

<style>
	button {
		margin: 20px;
	}
</style>